<ul class="menu{{ with .class }} {{ . }}{{ end }}">

	{{ $currentPage := .currentPage }}
	{{ $menuName := .menuName }}

	{{ range .menu }}
		{{ if .HasChildren }}

			{{ $class := slice (path.Base .URL) }}
			{{ if $currentPage.HasMenuCurrent $menuName . }}
				{{ $class = $class | append "active" }}
			{{ end }}

			<li class="{{ delimit $class ` ` }}">
				<h3>{{ .Name }}</h3>
				<ul class="sub-menu">
					{{ range .Children }}
						{{ partial "menu-item.html" (dict "context" . "currentPage" $currentPage "menuName" $menuName) }}
					{{ end }}
				</ul>
			</li>

		{{ else }}

			{{ partial "menu-item.html" (dict "context" . "currentPage" $currentPage "menuName" $menuName) }}

		{{ end }}
	{{ end }}

</ul>
